﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.Entity;
using System.Data.Entity.Migrations;
using Devtalk.EF.CodeFirst;

namespace WillCallLib
{
    public partial class Keyed
    {
        public int Id { get; set; }
    }

    public partial class Named : Keyed
    {
        public String Name { get; set; }
    }

    public partial class TimeSlot : Keyed
    {
        public DateTime TimeStart { get; set; }
        public DateTime TimeEnd { get; set; }
    }

    public partial class Presentation : Named
    {
        public Event Event { get; set; }
        public IList<TimeSlot> Schedule { get; set; }
        public IList<Session> Sessions { get; set; }
    }

    public partial class Session : Keyed
    {
        public Presentation Presentation { get; set; }
        public IList<TimeSlot> TimeSlots { get; set; }
    }
    public partial class Event : Named
    {
        public Host Host { get; set; }
        public IList<Presentation> Presentations { get; set; }
    }

    public partial class Host : Person
    {
        public IList<Event> Events { get; set; }
    }

    public partial class Person : Named
    {
        public String Email { get; set; }
        public String Phone { get; set; }

    }
    public partial class Guest : Person
    {
        public IList<Appointment> Appointments { get; set; }
    }

    public class Registration : Keyed
    {
        public Guest Guest { get; set; }
        public Event Event { get; set; }
    }

    public partial class Appointment : Keyed
    {
        public Session Session { get; set; }
    }


    public class EventContext : DbContext
    {
        public EventContext()
        {
            //Database.SetInitializer<EventContext>(new DropCreateDatabaseIfModelChanges<EventContext>());
            //Database.SetInitializer(new DontDropDbJustCreateTablesIfModelChanged<EventContext>());
        }
        //public EventContext(string conn)
        //    :base(conn) {}

        public DbSet<Host> Hosts { get; set; }
        public DbSet<Guest> Guests { get; set; }
        public DbSet<Registration> Registrations { get; set; }
        public DbSet<Event> Events { get; set; }
        public DbSet<Presentation> Presentations { get; set; }

    }
    public class Configuration : DbMigrationsConfiguration<EventContext>
    {
        public Configuration()
        {
            AutomaticMigrationsEnabled = true; AutomaticMigrationDataLossAllowed = true;
        }
    }
}
